home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / TCL1 / CSCROLLL / ABOUT_TH.E_F next >
Text File  |  1992-02-19  |  3KB  |  88 lines

  1.                 Some notes on CScrollList and CCheckList
  2.                 ========================================
  3.  
  4.  
  5. WARNING!! - I was tinkering when I put these two classes together.
  6.             Because I still intend to rewrite my own CTable and CArrayPane
  7.             classes that are based on a single column implementation, I
  8.             didn't design these to stand the test of time.  So, if you feel
  9.             there isn't enough error checking or that they are not robust
  10.             enough for you, hack the code apart and rewrite it how _you_
  11.             think it should be written.
  12.     
  13.   ( IF, on the other hand, you find yourself staring at my code in awe and
  14.     thinking aloud, "My God, this guy's a genius!" call your shrink 'cause
  15.     you need help, but call me first because I could _really_ use a job!   )
  16.  
  17.  
  18. In any event, there are a few things you should know about the classes:
  19.  
  20.   Ñ They expect two cursor handles to be loaded and locked (HNoPurge'd).
  21.   Ñ They require CTextEnvirons, CArrayPane, CTable, and CTableDragger.
  22.         These are non-core TCL classes, so don't forget them!
  23.   Ñ You must override a few methods to make them do anything useful.
  24.  
  25.  
  26. CURSOR RESOURCES
  27. ================
  28.  
  29. To load and lock the resources (for better or for worse), I just put the
  30. following code in my IMyApp method:
  31.  
  32.     gCheckCursor = GetCursor( kCheckCursorID);        // Get both cursors
  33.     HNoPurge( (Handle) gCheckCursor);
  34.     gHandCursor = GetCursor( kHandCursorID);
  35.     HNoPurge( (Handle) gHandCursor);
  36.  
  37. For your convenience, the two 'curs' resources have been included.
  38.  
  39.  
  40. NON-CORE CLASSES
  41. ================
  42.  
  43. What can I say?  Simply make sure they are in your project.  Take a look at
  44. the NewClassDemo project that came with THINK C as an example.
  45.  
  46.  
  47. OVERRIDING FUNCTIONS
  48. ====================
  49.  
  50. To use CScrollList, you must override GetCellText which is originally
  51. from the CTable class.
  52.  
  53.     void    CYourSList::GetCellText( Cell theCell,
  54.                         short availableWidth, StringPtr itsText)
  55.  
  56. CCheckList requires you to override two more methods: CheckCell and
  57. IsChecked.  The prototypes for these methods are
  58.  
  59.     Boolean        CYourCList::IsChecked( Cell theCell )
  60.     
  61.     void        CYourCList::CheckCell( Cell theCell )
  62.  
  63. One might also argue that there should be a SetCheck method, just as there
  64. should be a SetItemEnable for menu items.  But that's a different story...
  65.  
  66.  
  67. FURTHER NOTES
  68. =============
  69.  
  70. To create your own cool lists, just rewrite (I mean override :)
  71. the DrawCell method so it doesn't rely on text, or so you can include
  72. other graphics and text, etc.
  73.  
  74.     void        CYourCList::DrawCell( Cell theCell, Rect *cellRect )
  75.  
  76. If you do anything with these classes, I'd really like to see it (if that
  77. is possible).  I'm curious as to what others are doing with the TCL, and
  78. I can always use more sample code.  At least write me a note acknowledging
  79. my existance.
  80.  
  81.  
  82. PLEASE send questions and comments (job offers ;) to
  83.  
  84.     AOL:            Dave J H
  85.     internet:        a540dav@pic.ucla.edu
  86.  
  87. Good luck, and enjoy!
  88.